package com.longjianghuasheng.logistics.business.detail

import com.blankj.utilcode.util.ColorUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.databinding.ItemWarehousingBinding

class WarehousingAdapter :
    BaseQuickAdapter<WarehousingEntity, BaseDataBindingHolder<ItemWarehousingBinding>>(R.layout.item_warehousing) {
    override fun convert(
        holder: BaseDataBindingHolder<ItemWarehousingBinding>,
        item: WarehousingEntity
    ) {
        holder.dataBinding?.run {

            tvWarehousing.text = item.title


            tvWarehousing.setTextColor(ColorUtils.getColor(if (item.isSelected) R.color.white else R.color.black3))


            if (item.is_use == 1) {

                tvWarehousing.setBackgroundResource(R.drawable.shape_has_occupied_warehousing)
            } else {
                tvWarehousing.setBackgroundResource(if (item.isSelected) R.drawable.shape_select_warehousing else R.drawable.shape_unselect_warehousing)
            }


        }
    }
}